Skip to content

feat: add --debug flag for HTTP request/response logging with credential redaction#80

Merged
deviantintegral merged 6 commits intomainfrom
plan/18-http-debug-logging
Mar 11, 2026
Merged

feat: add --debug flag for HTTP request/response logging with credential redaction#80
deviantintegral merged 6 commits intomainfrom
plan/18-http-debug-logging

Conversation

@deviantintegral
Copy link
Owner

@deviantintegral deviantintegral commented Mar 11, 2026

Summary

  • Add --debug flag for full HTTP request/response tracing at DEBUG level with credential redaction
  • Restructure --verbose to map to INFO level (was DEBUG), showing request summaries and auth lifecycle
  • Create shared _http_logging.py module with redact_headers, redact_body, log_request, log_response
  • Migrate b2c_login.py to shared HTTP logging helpers (removes local duplicates)
  • Promote key client.py and auth.py messages from DEBUG to INFO for --verbose visibility

Details

  • --verbose and --debug are mutually exclusive via argparse
  • Default log level remains WARNING (no flags)
  • Redacts: Authorization (preserves Bearer prefix), Cookie, Set-Cookie, X-CSRF-TOKEN headers, and password in form data
  • Response bodies truncated to 2000 chars in debug output
  • run_tui() signature changed from verbose: bool to log_level: int
  • 23 new tests for _http_logging module; all 1230 tests pass

Test plan

  • ruff check passes
  • mypy --strict passes
  • All 1230 tests pass
  • New test_http_logging.py covers redaction, logging, and client integration

🤖 Generated with Claude Code

@deviantintegral deviantintegral changed the title chore(plan): add plan 18 for HTTP debug logging with credential redaction feat: add --debug flag for HTTP request/response logging with credential redaction Mar 11, 2026
deviantintegral and others added 5 commits March 11, 2026 13:49
…tion

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a shared HTTP logging module (_http_logging.py) with credential
redaction utilities. Restructure CLI flags so --verbose maps to INFO
level and the new --debug flag maps to DEBUG level (default remains
WARNING). Promote key auth lifecycle and request summary messages
from DEBUG to INFO so --verbose produces useful output.

- Add _http_logging.py with redact_headers, redact_body, log_request,
  log_response
- Make --verbose and --debug mutually exclusive in argparse
- Change run_tui() signature from verbose: bool to log_level: int
- Promote client.py request summary and auth.py lifecycle messages
  to INFO

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wire the shared _http_logging module into client.py._request for full
HTTP request/response tracing at DEBUG level. Migrate b2c_login.py to
use the shared log_request/log_response helpers instead of its local
copies, ensuring consistent credential redaction across all HTTP calls.

- client.py._request now logs redacted headers and response bodies
- b2c_login.py local _log_request/_log_response removed
- Add comprehensive tests for _http_logging module (23 tests)
- Update b2c_login and client test assertions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make redact_body match sensitive keys like "password" regardless of
casing (e.g. "Password", "PASSWORD") to match how redact_headers
already works for header names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@deviantintegral deviantintegral force-pushed the plan/18-http-debug-logging branch from 7db3fea to 3cb30a4 Compare March 11, 2026 17:49
@deviantintegral deviantintegral enabled auto-merge (squash) March 11, 2026 17:57
@deviantintegral deviantintegral merged commit 050e74d into main Mar 11, 2026
5 checks passed
@deviantintegral deviantintegral deleted the plan/18-http-debug-logging branch March 11, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant